/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __QS_TextEdit_H__
#define __QS_TextEdit_H__

#include <QtGui/QTextEdit>

class QCompleter;


namespace QSThink
{
	class RichTextEdit : public QTextEdit
	{
		Q_OBJECT

	public:
		RichTextEdit(QWidget *parent = 0);
		~RichTextEdit();

		void setCompleter(QCompleter *c);
		QCompleter *completer() const;

	protected:
		void keyPressEvent(QKeyEvent *e);
		void focusInEvent(QFocusEvent *e);

	private slots:
		void insertCompletion(const QString &completion);

	private:
		QString textUnderCursor() const;

	private:
		QCompleter *_completer;
	};
}

#endif



